const fs = require('fs');

function readJSONFile(filePath, callback) {
    fs.readFile(filePath, 'utf-8', (err, data) => {
        if (err) {
            callback(err);
            return;
        }
        try {
            const jsonContent = JSON.parse(data);
            callback(null, jsonContent);
        } catch (err) {
            callback(err);
        }
    });
}

function readJSONFileSync(filePath) {
    const jsonData = fs.readFileSync(filePath, 'utf-8');
    return JSON.parse(jsonData);
}

module.exports = {
    readJSONFile,
    readJSONFileSync
};
